package team.xstudio.bedwarstoolkit.ingame

import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.PlayerEnderChestContainer
import team.xstudio.bedwarstoolkit.ingame.BWGameManager.getTeamByPlayer
import team.xstudio.bedwarstoolkit.utils.BWUtils

/**
 * Created in 2025/6/11
 * Project: bedwarstoolkit
 *
 * @author <a href="https://github.com/Bread-Nicecat">Bread_NiceCat</a>
 * <p>
 *
 * <p>
 **/
object BWGameEventHandlers {

    //当玩家起床战争中时，返回队伍的末影箱，否则返回玩家的末影箱
    fun useOnEnderChest(player: Player): PlayerEnderChestContainer? {
        return getTeamByPlayer(player)?.run {
            BWUtils.LOGGER.info("redirect player ${player.displayName.string},uuid=${player.stringUUID} from player enderchest to team")
            teamChest
        } ?: player.enderChestInventory
    }
}